#pragma once

#include <string>


//数据库配置
const std::string host = "127.0.0.1";
const std::string DB_user = "oj_client";
const std::string DB_passwd = "1234";
const std::string DB = "VR";
const int port = 3306;

//数据库表名
const std::string Users_Tab = "Users";
const std::string Emails_Tab = "Emails";
const std::string MachineCodes_Tab = "MachineCodes";
const std::string EmailMachineAuths_Tab = "EmailMachineAuths";

//邮箱配置
#define ServerEmail "18226802593@163.com"
#define ServerEmail_Pwd "TKsfeCHGDmyrM9YK"
#define Email_Subject "VR-OJ-Verification"

enum class OperationType : short
{   
    INSERT,
    SELECT
};

// struct Users
// {
//     int UserID;
//     std::string UserName;
//     std::string Password;
//     std::string Create_time;
//     std::string Update_time;
// };

// struct Emails
// {
//     int EmailID;
//     int UserID;
//     std::string Email;
//     bool IsVerified;
//     std::string Create_time;
// };

// struct MachineCodes{
//     int MachineID;
//     int UserID;
//     std::string MachineCode;
//     std::string Create_time;
// };

// struct EmailMachineAuths
// {
//     int AuthID;
//     int EmailID;
//     int MachineID;
//     std::string AuthCode;
//     bool IsVerified;
//     std::string Create_time;
// };



enum class ColumnDataType {
    INT_TYPE,
    STRING_TYPE,
    BOOL_TYPE,
    
};

struct TableColumnInfo {
    std::string columnName;
    ColumnDataType dataType;
    TableColumnInfo(const std::string& name, ColumnDataType type) : columnName(name), dataType(type) {}
};

struct GeneralDataBase {
    virtual ~GeneralDataBase() {}
};


struct Users : public GeneralDataBase {
    int UserID;
    std::string UserName;
    std::string Password;
    std::string Create_time;
    std::string Update_time;
};

//user-email:  1-1
struct Emails : public GeneralDataBase {
    int EmailID;
    int UserID;
    std::string Email;
    bool IsVerified;
    std::string Create_time;
};

//MachineID:UserID = n:1
struct MachineCodes : public GeneralDataBase {
    int MachineID;
    int UserID;
    std::string MachineCode;
    std::string Create_time;
};

//验证码
//EmailID:MachineID = 1:n
struct EmailMachineAuths : public GeneralDataBase {
    int AuthID;  //当主键用的
    int EmailID;
    int MachineID;
    std::string AuthCode;
    bool IsVerified;
    std::string Create_time;
};

enum class LoginType: short
{
    WITH_PWd,
    WITH_CAPTCHA
};